package com.mini.spring.beanfactory.ac;

import java.util.Scanner;

/**
 * @author: 屠一乐
 * @date: 2023/8/22 16:54
 * @description:
 */
public class Main5137 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int t = scanner.nextInt();
        while(t-->0) {
            long n = scanner.nextLong();
            System.out.println(n/2<=1?"0":(n-1)/2+"");
        }
    }
}
